package ltd.hyangyang.rpc.core.remoting.client;

import io.netty.channel.Channel;
import ltd.hyangyang.rpc.common.bean.Response;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;

public class UnfinishChannel {

    public  static ConcurrentHashMap<String, CompletableFuture<Response>> progressFutureTask = new ConcurrentHashMap<>();

    public static CompletableFuture<Response> getProgressFuture(String requestId){
        CompletableFuture<Response> responseCompletableFuture = progressFutureTask.get(requestId);
        if (responseCompletableFuture==null){
            responseCompletableFuture = new CompletableFuture<>();
            progressFutureTask.put(requestId,responseCompletableFuture);

        }
        return responseCompletableFuture;
    }
}
